package com.example.easy.Controller;


import com.example.easy.Dto.HealthSecurity;
import com.example.easy.Dto.PublicSecurity;
import com.example.easy.Service.myservice.HealthSecurityServise;
import com.example.easy.Service.myservice.PublicSecurityServise;
import com.example.easy.Tools.ResultCode;
import com.example.easy.mapper.HealthSecurityMapper;
import com.example.easy.mapper.PublicSecurityMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@Scope("prototype")
@RestController
@Api(value = "PublicSecurity", description = "景区安保")
@RequestMapping(value = "/publicSecurity")

public class PublicSecurityController {


    @Autowired
    PublicSecurityMapper publicSecurityMapperr;

    @Autowired
    PublicSecurityServise publicSecurityServise;

    @ApiOperation(value = "增加景区安全信息", notes = "增加景区安全信息")
    @RequestMapping(value = "/insPublicSecurity", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public Object insPublicSecurity(@RequestBody PublicSecurity publicSecurity) throws IOException {

        return ResultCode.SUCCESS.result(publicSecurityServise.insPublicSecurity(publicSecurity));

    }

    @ApiOperation(value = "修改景区安全信息", notes = "修改景区安全信息")
    @RequestMapping(value = "/updatePublicSecurity", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public Object updatePublicSecurity(@RequestBody PublicSecurity publicSecurity) throws IOException {

        return ResultCode.SUCCESS.result(publicSecurityServise.updatePublicSecurity(publicSecurity));

    }

    @ApiOperation(value = "删除景区安全信息", notes = "删除景区安全信息")
    @RequestMapping(value = "/deletePublicSecurity", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public Object deletePublicSecurity(@RequestBody int number) throws IOException {

        return ResultCode.SUCCESS.result(publicSecurityServise.deletePublicSecurity(number));

    }

    @ApiOperation(value = "查看景区安全信息", notes = "查看景区安全信息")
    @RequestMapping(value = "/selectPublicSecurity", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public Object selectPublicSecurity(@RequestBody int number) throws IOException {

        return ResultCode.SUCCESS.result(publicSecurityServise.selectPublicSecurity(number));

    }

    @ApiOperation(value = "查看所有景区安全信息", notes = "查看所有景区安全信息")
    @RequestMapping(value = "/selectall", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public Object selectall() throws IOException {

        return ResultCode.SUCCESS.result(publicSecurityServise.selectall());

    }

}
